{include file="common/head"}
<head>
<title>教练车编辑</title>
</head>
<body style="">
    <div class="container p-3 my-3 " style="max-width: 600px;"  >
    <h2>教练车编辑</h2>
    <form method="post" enctype="multipart/form-data" action="/index.php/car/edit">

      <input type="hidden" name="id" id="id" value="{$data.id}" />
      <div class="mb-3 mt-3">
        <lable for="fid" class="form-label">所属分类(Categray):</label>
        <select id="cat" name="cat" class="form-control">
            {foreach $category as $k=>$v}
                {if $k==$data.cat}
                    <option value="{$k}" selected >{$v['name']}</option>
                {else}
                    <option value="{$k}" >{$v['name']}</option>
                {/if}
            {/foreach}
        </select>
      </div>

      <div class="mb-3 mt-3">
        <lable for="dept_id" class="form-label">所属驾校:</label>
        <select id="dept_id" name="dept_id" class="form-control">
          <option value="" >未选选择</option>
          {foreach $school as $dept}
              <option value="{$dept.id}" {if $dept.id== $data.dept_id} selected {/if} >{$dept['name']}</option>
          {/foreach}
        </select>
      </div>

      <div class="mb-3">
        <label for="license" class="form-label">车牌号:</label>
        <input type="text" class="form-control" id="license" name="license" value="{$data['license']}" placeholder="license" />
      </div>

      <div class="mb-3 mt-3">
        <lable for="name" class="form-label">车型:</label>
        <input type="text" class="form-control" id="name" name="name" value="{$data['name']}" placeholder="name" />
      </div>
      <div class="mb-3 mt-3">
        <lable for="year" class="form-label">年份:</label>
        <input type="text" class="form-control" id="year" name="year" value="{$data['year']}" placeholder="year" />
      </div>
      <div class="mb-3">
        <label for="style" class="form-label">款式:</label>
        <input type="text" class="form-control" id="style" name="style" value="{$data['style']}" placeholder="style" />
      </div>

      <div class="mb-3">
        <label for="trainer_id" class="form-label">分配教练:</label>
        <select id="trainer_id" name="trainer_id" class="form-control">
            <option value="0" >未绑定教练</option>
            {foreach $trainer_list as $k=>$v}
                {if $v['id']==$data.trainer_id}
                    <option value="{$v['id']}" selected >{$v['name']}</option>
                {else}
                    <option value="{$v['id']}" >{$v['name']}</option>
                {/if}
            {/foreach}
          </select>
      </div>

      <div class="mb-3">
        <label for="status" class="form-label">是否启用:</label>
          <input type="radio" class="form-check-input" id="radio1" name="status" value="1" {if $data.status==1} checked {/if}/> 
          <label class="form-check-label" for="radio1">启用</label>
          <input type="radio" class="form-check-input" id="radio2" name="status" value="2" {if $data.status==2} checked {/if}/>
          <label class="form-check-label" for="radio2">停用</label>
       </div>
      <div class="mb-3">
        <img src="{$data.imgs}" style="width: 100px;"/><br />
        <label for="file" class="form-label">上传图片(Image):</label>
        <input type="file"  name="file" /> <br /> 
      </div>       
       

      <button  type="button" class="btn btn-primary" onclick="doSave()">保存(Save)</button>

    </form>
    </div>

<script type="text/javascript">
  function doSave(){

    $('form').submit();
  }
</script>


</body>
</html>
